package com.xiaoma.tpo.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xiaoma.tpo.baseDao.BaseDaoImpl;
import com.xiaoma.tpo.baseDao.DefaultRowMapper;
import com.xiaoma.tpo.domain.ActivityType;

@Repository
public class ActivityTypeDao extends BaseDaoImpl<ActivityType> {

	@SuppressWarnings("unchecked")
	public List<ActivityType> findAll(Integer pageNum, Integer pageSize) {
		String sql = "select * from activity_type where is_delete=0 limit ?,?";
		List<?> list = jdbcTemplate.query(sql, new DefaultRowMapper(
				ActivityType.class, getNameHandler()), (pageNum - 1) * pageSize, pageSize);

		return (List<ActivityType>) list;
	}
	
	@SuppressWarnings("unchecked")
	public List<ActivityType> findAll() {
		String sql = "select * from activity_type where is_delete=0";
		List<?> list = jdbcTemplate.query(sql, new DefaultRowMapper(
				ActivityType.class, getNameHandler()));

		return (List<ActivityType>) list;
	}
}
